package tienmanh.gs.goldminer.particle;


import org.andengine.entity.Entity;
import org.andengine.entity.particle.BatchedPseudoSpriteParticleSystem;
import org.andengine.entity.particle.emitter.IParticleEmitter;
import org.andengine.entity.particle.initializer.AccelerationParticleInitializer;
import org.andengine.entity.particle.initializer.RotationParticleInitializer;
import org.andengine.entity.particle.initializer.ScaleParticleInitializer;
import org.andengine.entity.particle.initializer.VelocityParticleInitializer;
import org.andengine.entity.particle.modifier.AlphaParticleModifier;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import android.opengl.GLES20;

public class BubbleAnimation extends BatchedPseudoSpriteParticleSystem {

	public BubbleAnimation(IParticleEmitter pParticleEmitter,
			float pRateMinimum, float pRateMaximum, int pParticlesMaximum,
			ITextureRegion pTextureRegion,
			VertexBufferObjectManager pVertexBufferObjectManager) {
		super(pParticleEmitter, pRateMinimum, pRateMaximum, pParticlesMaximum,
				pTextureRegion, pVertexBufferObjectManager);
		// TODO Auto-generated constructor stub
		
		this.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE);
		this.addParticleInitializer(new VelocityParticleInitializer<Entity>(-3, 3, -20, -40));
		this.addParticleInitializer(new AccelerationParticleInitializer<Entity>(-3, 3, -3, -5));
		this.addParticleInitializer(new RotationParticleInitializer<Entity>(0.0f, 360.0f));
		this.addParticleInitializer(new org.andengine.entity.particle.modifier.ExpireParticleInitializer<Entity>(10f));
		this.addParticleInitializer(new ScaleParticleInitializer<Entity>(0.2f, 0.5f));
		this.addParticleInitializer(new RegisterXSwingEntityModifierInitializer<Entity>(10f, 0f, (float) Math.PI * 8, 3f, 25f, true));

		this.addParticleModifier(new AlphaParticleModifier<Entity>(6f, 10f, 1.0f, 0.0f));
	}

}
